'use strict';

import * as actions from '../../actions/ring_tags_step1';

// 对页面prop 数据进行管理
const initialState = {
  loading: false,
  error:false,
  loginError:false,
  message:"",
  curActive:false,
};
const defaultAction = {
  type: 'doNothing'
};
export default function index(state = initialState, action = defaultAction) {
    switch (action.type) {
		case actions.LOAD_START:
			return Object.assign({}, state, {
				loading:true,
				error:false,
				loginError:false
			});
		break;
		case actions.LOAD_ERR:
			return Object.assign({}, state, {
				loading:false,
				error:true,
				loginError:action.loginFalse,
				message:action.message
			});
		break;
		case actions.CLOSE_DIALOG:
			return Object.assign({}, state, {
				showChoseDialog:false,
				loading:false,
				error:false,
				loginError:false,
			});
		break;
		case actions.CREATE_TAG:
			return Object.assign({}, state, {
			loading:true,
			error:false,
			loginError:false
			});
		break;
		case actions.CREATE_TAG_DONE:
			return Object.assign({}, state, {
			loading:false,
			error:false,
			loginError:false,
			showChoseDialog:true,
			newTask:action.newTask
			});
		break;
		case actions.CLOSE_CHOSE_DIALOG:
			return Object.assign({}, state, {
				showChoseDialog:false,
				loading:false,
				error:false,
				loginError:false,
			});
		break;
		case actions.LOAD_START:
			return Object.assign({}, state, {
			loading:true,
			error:false,
			loginError:false
			});
		break;
		default:
		return state;
	}
}
